﻿<?php
	defined('_JEXEC') or die(); 
    JHTML::_('behavior.tooltip'); 
?>
<style>
    #tbl_filter{
        margin: 0 ; padding: 0 ;
    }
    #tbl_filter td{
        padding: 3px;
    }
    #tbl_filter input, #tbl_filter img {
        float: left;
        margin: 0 5px 0 0;
        width: auto;
    }
    #extra_filter_field { width: 114px; }
    table.adminlist tbody tr td { padding: 8px 8px; }
    table.adminlist thead th { padding: 8px; }
</style>
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery-ui.css" />
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo JURI::root(); ?>js/multiselect/jquery.multiselect.js"></script>

<script>
jQuery(function(){
	var topDisplay = <?php echo empty($this->topDisplay)?20:$this->topDisplay;?>;
	jQuery("#topDisplaySelect").val(topDisplay);	
});
</script>

<div class="row-fluid">
    <?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
	<?php else : ?>
		<div id="j-main-container">
	<?php endif;?>
		<br clear="all">	
    	<div class="alert">
             <form action="<?php echo JRoute::_("index.php?option=com_wrd&controller=reports")?>" method="post" name="filterform" >
                <table style='margin-bottom:5px' id="tbl_filter">
                    <tbody>
                        <tr>
                            <td align="left" valign="top" style="">
                                <table >
                                    <tr>
                                        <td>Created Date From<br>
                                           <?php
                                               echo JHTML::_ ( 'calendar', ($this->pr['date_from'] != '') ? $this->pr['date_from'] : date('Y-m-d', mktime(0, 0, 0, date('m'), 1, date('Y'))), 'date_from', 'date_from', '%Y-%m-%d');
											?>
                                        </td>
										 
                                        <td>Created Date To<br>
                                            <?php
												echo JHTML::_ ( 'calendar', ($this->pr['date_to'] != '') ? $this->pr['date_to'] : date('Y-m-d', time()), 'date_to', 'date_to', '%Y-%m-%d');
											?>
                                        </td>
										<td><input type="submit" name="view" onclick="document.getElementById('task').value = '';" value="View" /></td>
                                   
										<td>
										Choose: <br>
                                           <select class="topDisplay" name="topDisplaySelect" id="topDisplaySelect">
                                                <option value="5">5</option>
												<option value="10">10</option>
												<option value="15">15</option>
												<option value="20">20</option>
												<option value="20">25</option>
                                                <option value="30">30</option>
                                                <option value="50">50</option>
                                                <option value="100">100</option>
												<option value="200">200</option>
												<option value="400">400</option>
												<option value="800">800</option>
                                                <option value="0">All</option>
												<option value="-1">Download All Members</option>
                                            </select>
											
                                        </td>
										<td colspan="6">
											<input type="submit" name="exportexcel" onclick="document.getElementById('task').value = 'exmemberreport';" value="Export to excel" />
										</td>
									</tr>
                                </table>                                
                            </td>                             
                           
                    </tr>

						
                </table>
<input type="hidden" name="controller" value="reports" />
<input type="hidden" name="option" value="com_wrd" />
<input type="hidden" name="layout" value="memberreport" />
<input type="hidden" name="task" id="task" value="" />
</form>   
</div> 
            <br />
<form  id="adminForm"  action="<?php echo JRoute::_("index.php?option=com_wrd")?>" method="post" name="adminForm" >			
<style>
.extra-adminlist strong { color:#025A8D; font-size: 1.2em; font-weight: bold; }
table.extra-adminlist .extra-adminlist-tr td {background: #F7F7F7; }
.filter-detail { border-top: 1px solid #CCC; padding-bottom: 3px; font-size: 1.4em; }
.filter-detail span { color: #e72222; }
</style>
<h3 class="filter-detail"><br/><span style="color:#C00; float:right;">Total: <?php echo $this->pagination->total; ?></span></h3>
<table class="adminlist extra-adminlist table">
<thead>
<tr>
<th width="3%">Order</th>
<th nowrap="nowrap">Member ID</th>        
<th nowrap="nowrap">Title</th>
<th nowrap="nowrap">Name</th>
<th nowrap="nowrap">DOB</th>
<th nowrap="nowrap">Mobile No</th>
<th nowrap="nowrap">Home No</th>
<th nowrap="nowrap">Email</th>
<th nowrap="nowrap">Address</th>
<th nowrap="nowrap">District</th>
<th nowrap="nowrap">City</th>
<th nowrap="nowrap">Company Name </th>
<th nowrap="nowrap">Points</th>	
<th nowrap="nowrap">Created Date</th>
<th nowrap="nowrap">Reapply Date</th>
 	
 </tr>
</thead>
<tbody>
<?php 
	
if(!empty($this->items)):
	$index = 0;
	$i=1;
	foreach($this->items as $key => $item):
	   $bg = $i%2;
		echo '<tr style="cursor: pointer;" class="row'.($bg).'" valign="top">';
			echo '<td>'.$i.'</td>';
			echo '<td>'.$item->member_id.'</td>';
			echo '<td>'.$item->prefix.'</td>';				
			echo '<td><a href="index.php?option=com_wrd&controller=profile&id='.$item->profile_id.'&layout=form" target="_blank">'.$item->l_name. " ".$item->f_name.'</a></td>'; 
			echo '<td>'.$item->dob.'</td>'; 
			echo '<td>'.$item->phone.'</td>'; 
			echo '<td>'.$item->referer_phone.'</td>';
			echo '<td>'.$item->email.'</td>';
			echo '<td>'.$item->address .'</td>';
			echo '<td>'.$item->distric .'</td>';
			echo '<td>'.$item->city .'</td>';
			echo '<td>'.$item->company_name .'</td>';
			
			//echo '<td>'.$item->nationality .'</td>';
			echo '<td>'.number_format($item->p_o_u,0,".",",") .'</td>';
			echo '<td>'.(strtotime($item->created_date) ? date("d-m-Y",strtotime($item->created_date)): "") .'</td>';
			echo '<td>'.(strtotime($item->reapply_date) ? date("d-m-Y",strtotime($item->reapply_date)): "") .'</td>';
		echo '</tr>';
	   $i++;
	endforeach;
endif;
?>
</tbody>
  <tfoot>
        <tr>
            <td colspan="16">
                <?php echo $this->pagination->getListFooter(); ?>
            </td>
        </tr>
    </tfoot>
</table>
<input type="hidden" name="controller" value="reports" />
<input type="hidden" name="option" value="com_wrd" />
<input type="hidden" name="topDisplaySelect" id="topDisplay" value="" />
<input name="status" type="hidden" class="status" value="" />
<input type="hidden" name="layout" value="memberreport" />
<!--<input type="hidden" name="task" value="redemptionreportvoucher" />-->
<input type="hidden" name="boxchecked" value="0" />
	<?php echo JHTML::_( 'form.token' ); ?>
</form>
</div>
        
</div>
